home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / FLI106C.ZIP;1 / BLBOX.CPP next >
Encoding:
C/C++ Source or Header  |  1992-03-12  |  3.4 KB  |  200 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.06c
  4. // Copyright (C) 1990, 1991, 1992
  5. // Software Dimensions
  6. //
  7. // BlazeClass
  8. //
  9.  
  10. #ifndef __BCPLUSPLUS__
  11. #pragma inline
  12. #endif
  13.  
  14. #include "fli.h"
  15.  
  16. #ifdef __BCPLUSPLUS__
  17. #pragma hdrstop
  18. #endif
  19.  
  20. #define I asm
  21.  
  22. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  23. //
  24. // Box()
  25. //
  26. // Draws an empty box on the screen
  27. //
  28. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  29.  
  30. void BlazeClass::Box(int X,int Y,int Width,int Height,int Color)
  31. {
  32.   if (Width<2 || Height<2 || X>=WinWide || Y>=WinHigh)
  33.     return;
  34.  
  35.   char TopLeft = BlazeClass::TopLeft;
  36.   char TopCenter = BlazeClass::TopCenter;
  37.   char TopRight = BlazeClass::TopRight;
  38.   char CenterLeft = BlazeClass::CenterLeft;
  39.   char CenterRight = BlazeClass::CenterRight;
  40.   char BottomLeft = BlazeClass::BottomLeft;
  41.   char BottomCenter = BlazeClass::BottomCenter;
  42.   char BottomRight = BlazeClass::BottomRight;
  43.  
  44.   int WinWide = BlazeClass::WinWide;
  45.   int WinHigh = BlazeClass::WinHigh;
  46.   int ScreenWidth = BlazeClass::QuickWidth;
  47.   int Locator = ((WinY+Y)*ScreenWidth)+((WinX+X)*2);
  48.  
  49.   void far *OUTPUT=BlazeClass::OUTPUT;
  50.   I les di,OUTPUT
  51.   I add di,Locator
  52.  
  53.   ScreenWidth-=2;
  54.  
  55.   I mov bx,[Width]
  56.   I sub bx,2
  57.   I mov dx,[Height]
  58.   I sub dx,2
  59.  
  60.   I mov ah,byte ptr Color
  61.   I mov al,TopLeft
  62.   I cld
  63.  
  64.   I stosw
  65.  
  66.   X++;
  67.  
  68.   if (_BX)
  69.   {
  70.     I mov cx,bx
  71.     do                            // top
  72.     {
  73.       if (X<WinWide && Y<WinHigh)
  74.       {
  75.         I mov ah,byte ptr Color
  76.         I mov al,TopCenter
  77.         I stosw
  78.       }
  79.       else
  80.       {
  81.         I inc di
  82.         I inc di
  83.       }
  84.       X++;
  85.     }
  86.     while (--_CX);
  87.   }
  88.  
  89.   if (X<WinWide && Y<WinHigh)   // corner top right
  90.   {
  91.     I mov ah,byte ptr Color
  92.     I mov al,TopRight
  93.     I stosw
  94.   }
  95.   else
  96.   {
  97.     I inc di
  98.     I inc di
  99.   }
  100.  
  101.   I add di,ScreenWidth
  102.   Y++;
  103.  
  104.   if (_DX)
  105.   {
  106.     I mov cx,dx
  107.     do                            // right
  108.     {
  109.       if (X<WinWide && Y<WinHigh)
  110.       {
  111.         I mov ah,byte ptr Color
  112.         I mov al,CenterRight
  113.         I stosw
  114.       }
  115.       else
  116.       {
  117.         I inc di
  118.         I inc di
  119.       }
  120.       I add di,ScreenWidth
  121.       Y++;
  122.     }
  123.     while (--_CX);
  124.   }
  125.  
  126.   I std
  127.  
  128.   if (X<WinWide && Y<WinHigh)   // corner bottom right
  129.   {
  130.     I mov ah,byte ptr Color
  131.     I mov al,BottomRight
  132.     I stosw
  133.   }
  134.   else
  135.   {
  136.     I dec di
  137.     I dec di
  138.   }
  139.  
  140.   X--;
  141.  
  142.   if (_BX)
  143.   {
  144.     I mov cx,bx
  145.     do                            // bottom
  146.     {
  147.       if (X<WinWide && Y<WinHigh)
  148.       {
  149.         I mov ah,byte ptr Color
  150.         I mov al,BottomCenter
  151.         I stosw
  152.       }
  153.       else
  154.       {
  155.         I dec di
  156.         I dec di
  157.       }
  158.       X--;
  159.     }
  160.     while (--_CX);
  161.   }
  162.  
  163.   if (X<WinWide && Y<WinHigh)   // corner bottom left
  164.   {
  165.     I mov ah,byte ptr Color
  166.     I mov al,BottomLeft
  167.     I stosw
  168.   }
  169.   else
  170.   {
  171.     I dec di
  172.     I dec di
  173.   }
  174.  
  175.   I sub di,ScreenWidth
  176.   Y--;
  177.  
  178.   if (_DX)
  179.   {
  180.     I mov cx,dx
  181.     do                            // left
  182.     {
  183.       if (X<WinWide && Y<WinHigh)
  184.       {
  185.         I mov ah,byte ptr Color
  186.         I mov al,CenterLeft
  187.         I stosw
  188.       }
  189.       else
  190.       {
  191.         I dec di
  192.         I dec di
  193.       }
  194.       I sub di,ScreenWidth
  195.       Y--;
  196.     }
  197.     while (--_CX);
  198.   }
  199. }
  200.